<?php
/************************/
/* 
 * 后台xajax功能实现
 * 程序编写：pennyowen/pepsi.zh
 * 联系邮箱：penyowen#gmail.com/pepsi.zh#gmail.com
 * 修改时间：2008-9-30
 */
/***********************/
include_once 'include.php';
include_once ("xajax_common.php");

function positionP($value,$id){
	global $dbconn,$dbtable;
	$objresponse = new xajaxResponse();
	if (!empty($id)){
		$query = "update ".$dbtable->frdlink." set Lorder=$value where Llinkid=$id";
		if ($dbconn->Query($query)){
			$checkresult = "<span>修改成功！</span>";	
		}else {
			$checkresult = "<span>修改失败！</span>";	
		}
	}
	$objresponse->addassign("result","innerHTML",$checkresult);//指定ID为result的元素中添加内容$checkresult
	return $objresponse;//返回结果文本
}
function advTypeInfo($value,$id){
	global $dbconn,$dbtable;
	$objresponse = new xajaxResponse();
	if ($value){
		$query = "select CAdesc from ".$dbtable->advcata." where CAid=$value limit 1";
		if (($row = $dbconn->Getonefield($query))){
			$query = "select count(*) from ".$dbtable->adv." where CAid=$value and Ashow='y'";
			$artNum = $dbconn->Getonefield($query);
			$artNum = $artNum?$artNum:0;
			$objresponse->addassign($id,"innerHTML",$row.",目前该类有<b> $artNum </b>条记录");
		}
	}else {
		$objresponse->addassign($id,"innerHTML",'');
	}
	//$objresponse->addAlert($query);
	return $objresponse;//返回结果文本
}
function positionAdv($value,$id){
	global $dbconn,$dbtable;
	$objresponse = new xajaxResponse();
	if (!empty($id)){
		$query = "update ".$dbtable->adv." set Atop=$value where Adid=$id";
		if ($dbconn->Query($query)){
			$checkresult = "<span>修改成功！</span>";	
		}else {
			$checkresult = "<span>修改失败！</span>";	
		}
	}
	$objresponse->addassign("result","innerHTML",$checkresult);//指定ID为result的元素中添加内容$checkresult
	return $objresponse;//返回结果文本
}
$xajax->processRequests();

?>